package DTaskTowerApp;
use Mojo::Base 'Mojolicious';

sub startup
{
	my $self = shift;
	say "call startup $self";
	my $r = $self->routes;

	$r->post('/token')->to('tower#getAccessToken');
	
	$r->get('/members')->to('tower#getTeamMembers');

	$r->get('/projects')->to('tower#getProjects');

	$r->get('/projects/:project_guid/todolists')->to('tower#getTodoLists');
	
	my $todo = $r->route('/todo')->to(controller => 'Tower');

	$todo->post('/')
		->to(action => 'addTodo')
		->name(action => 'AddTodo');


	$r->post('/project/:project/todolist')
		->to(controller => 'Tower' , action => 'addTodoList')
		->name('AddTodoList');

	$r->post('/todolist/:todolist/comment')
		->to(controller => 'Tower' , action => 'addTodoListComment')
		->name('AddTodoListComment');

	my $todo_guid = $todo->route('/:todo_guid');

	# POST /tower/todo/:todo_guid/comment
	$todo_guid->post('/comment')
		->to(action => 'addTodoComment')
		->name('AddTodoComment');
	#imp
	# PUT /tower/todo/:todo_guid/task
	$todo_guid->put('/task')
		->to(action => 'newTaskWithTowerTodo')
		->name('NewTaskWithTowerTodo');

	#imp
	# GET /tower/todo/:todo_guid/task
	$todo_guid->get('/task')
		->to(action => 'getTaskByTowerTodo')
		->name('GetTaskByTowerTodo');

	# GET /tower/todo/:todo_guid/link_info
	$todo_guid->get('/link_info')
		->to(action => 'getTaskLinksInfoByTowerTodo')
		->name('GetTaskLinksInfoByTowerTodo');
}

1;
